<?php

error_reporting(E_ALL);

require_once 'phpexcel/Classes/PHPExcel.php';
require_once 'phpexcel/Classes/PHPExcel/IOFactory.php';
$objPHPExcel = new PHPExcel();

// Read from Excel2007 (.xlsx) template
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("../../templates/Template-Occurrence-1.0.xlsx");
$objPHPExcel->setActiveSheetIndex(2);

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV')
    ->setDelimiter(',')
    ->setEnclosure('')
    ->setLineEnding("\r\n")
    ->setSheetIndex(2)
    ->save(str_replace('.php', '.csv', __FILE__));
		
?>